-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: test untested path in ak.cartesian
& broadcasting
#2329
Conversation
@jpivarski as this touches broadcasting code, I'd appreciate your eyes to take a close look at the changes to |
Codecov Report
Additional details and impacted files
|
@@ -160,7 +160,7 @@ def all_same_offsets(backend: ak._backends.Backend, inputs: list) -> bool: | |||
my_offsets = index_nplike.empty(0, dtype=np.int64) | |||
else: | |||
my_offsets = index_nplike.arange( | |||
0, x.content.length, x.size, dtype=np.int64 | |||
0, x.content.length + 1, x.size, dtype=np.int64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want a range that is inclusive of the endpoints, which is not the case by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do? Oh, yes—we do! Offsets always have to be one longer than the array itself; that's right. Good catch!
elif isinstance(x, RegularArray): | ||
nextinputs.append(x.content[: x.size * x.length]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We test for RegularArray
in all_same_offsets
, but here we weren't actually pulling out the content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic; I'm glad you found this.
@@ -160,7 +160,7 @@ def all_same_offsets(backend: ak._backends.Backend, inputs: list) -> bool: | |||
my_offsets = index_nplike.empty(0, dtype=np.int64) | |||
else: | |||
my_offsets = index_nplike.arange( | |||
0, x.content.length, x.size, dtype=np.int64 | |||
0, x.content.length + 1, x.size, dtype=np.int64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do? Oh, yes—we do! Offsets always have to be one longer than the array itself; that's right. Good catch!
This PR:
ak.cartesian
broadcast_and_apply
that required this patchak.cartesian